//Author Dmitry Savchenko
function enableInput(inputName, enabled){
    var input=$("#"+inputName);
    if(enabled===false){
        input.attr("disabled", "disabled");
    }else{
        input.removeAttr("disabled");
    }
}

function markAsError(input, message) {
    var className = "errorInput";
    if (message !== null) {
        if (!input.hasClass(className)) {
            input.addClass(className);
        }
        var inputName = "#" + input.attr("name") + "Error";
        $(inputName).text(message);
    } else {
        if (input.hasClass(className)) {
            input.removeClass(className);
        }
        var inputName = "#" + input.attr("name") + "Error";
        $(inputName).text("");
    }
}